﻿@{
    ViewBag.Title = "";
    var id = Model != null ? Model.ID : 0;
}
@using ZBJF.Warranty.Common.Enums.Certificate
@using ZBJF.Warranty.Common.Enums.InsuranceOrder
@model ZBJF.Warranty.Model.InsuranceOrder
<ul class="nav nav-tabs">
    <li class="active"><a href="/InsuranceOrder/Edit/@id">保单详情</a></li>
</ul>
@using (Html.BeginForm("AuditInsuranceOrder", "InsuranceOrder", FormMethod.Post, new { id = "mvcForm", name = "mvcForm", @class = "form-horizontal", enctype = "multipart/form-data" }))
{
    @Html.AntiForgeryToken()
    @Html.HiddenFor(c => c.ID)
    <table class="table table-responsive table-bordered table-hover">
        <tr><th colspan="4" class="group-header">订单信息</th></tr>
        <tr>
            <th>设备识别码：</th>
            <td>
                @Html.DisplayFor(o => o.OrderNO)
            </td>
            <th>保险产品名称：</th>
            <td>
                @Html.DisplayFor(o => o.ProductName)
            </td>
        </tr>
        <tr>
            <th>保险类别名称：</th>
            <td>
                @Html.DisplayFor(o => o.InsuranceCategoryName)
            </td>
            <th>下单时间：</th>
            <td>
                @Html.DisplayFor(o => o.CreateOrderTime)
            </td>
        </tr>
        <tr>
            <th>保期：</th>
            <td>
                @Html.DisplayFor(o => o.PolicyPeriod)
                @ZBJF.Warranty.Common.Common.EnumHelper.Instance.GetDescription(typeof(InsuranceOrderPeriodUnit), Model.PolicyPeriodUnit)
            </td>
            <th>工单状态：</th>
            <td>
                @ZBJF.Warranty.Common.Common.EnumHelper.Instance.GetDescription(typeof(InsuranceOrderStatus), Model.OrderStatus)
            </td>
        </tr>
        <tr>
            <th>工单来源：</th>
            <td>
                @ZBJF.Warranty.Common.Common.EnumHelper.Instance.GetDescription(typeof(InsuranceOrderFromType), Model.OrderFromType)
            </td>
            <th>校验凭证：</th>
            <td>
                @Html.DisplayFor(o => o.VerificationCertificate)
            </td>
        </tr>
        <tr>
            <th>投保平安卡号：</th>
            <td>
                @Html.DisplayFor(o => o.CardNo)
            </td>
            <th>投保平安卡密：</th>
            <td>
                @Html.DisplayFor(o => o.CardPwd)
            </td>
        </tr>
        <tr>
            <th>购买方式：</th>
            <td>
                @ZBJF.Warranty.Common.Common.EnumHelper.Instance.GetDescription(typeof(InsuranceBuyType), Model.BuyType)
            </td>
            <th>价格：</th>
            <td>
                @Html.DisplayFor(o => o.Price)
            </td>
        </tr>
        <tr>
            <th>生效日期：</th>
            <td>
                @Html.DisplayFor(o => o.EffectiveDate)
            </td>
            <th>生效等待天数：</th>
            <td>
                @Html.DisplayFor(o => o.WaitDays) 天
            </td>
        </tr>
        <tr><th colspan="4" class="group-header">用户信息</th></tr>
        <tr>
            <th>被保险人：</th>
            <td>
                @Html.DisplayFor(o => o.UserName)
            </td>
            <th>被保险人电话：</th>
            <td>
                @Html.DisplayFor(o => o.UserPhone)
            </td>
        </tr>
        <tr>
            <th>证件类型：</th>
            <td>
                @ZBJF.Warranty.Common.Common.EnumHelper.Instance.GetDescription(typeof(UserCertificateType), Model.CertificateType)
            </td>
            <th>证件号码：</th>
            <td>
                @Html.DisplayFor(o => o.CertificateNO)
            </td>
        </tr>
        <tr><th colspan="4" class="group-header">产品信息</th></tr>
        <tr>
            <th>设备类型：</th>
            <td>
                @Html.DisplayFor(o => o.ProductTypeName)
            </td>
            <th>设备识别码：</th>
            <td>
                @Html.DisplayFor(o => o.IMEI)
            </td>
        </tr>
        <tr>
            <th>UUID：</th>
            <td>
                @Html.DisplayFor(o => o.IDFV)
            </td>
            <th>产品品牌名称：</th>
            <td>
                @Html.DisplayFor(o => o.ProductBrandName)
            </td>
        </tr>
        <tr>
            <th>产品型号：</th>
            <td>
                @Html.DisplayFor(o => o.ProductModelName)
            </td>
            <th></th>
            <td></td>
        </tr>
        <tr><th colspan="4" class="group-header">销售信息</th></tr>
        <tr>
            <th>销售商户名称：</th>
            <td>
                @Html.DisplayFor(o => o.SaleVendorName)
            </td>
            <th>销售人姓名：</th>
            <td>
                @Html.DisplayFor(o => o.SalePersonName)
            </td>
        </tr>
        <tr>
            <th>负责人姓名：</th>
            <td>
                @Html.DisplayFor(o => o.SaleManagerName)
            </td>
            <th>负责人电话：</th>
            <td>
                @Html.DisplayFor(o => o.SaleManagerPhone)
            </td>
        </tr>
        <tr>
            <th>销售商地址：</th>
            <td colspan="3">
                @Html.DisplayFor(o => o.SaleAddress)
            </td>
        </tr>
        <tr><th colspan="4" class="group-header">审核信息</th></tr>
        <tr>
            <td colspan="4">
                <table class="w-p100">
                    <tr>
                        <th width="20">序号</th>
                        <th width="100px">内容</th>
                        <th>备注</th>
                        <th width="230px">检测时间</th>
                        <th width="166px">检测人</th>
                    </tr>
                    @for (int i = 0; i < Model.InsuranceOrderCheckLog.Count; i++)
                    {
                        <tr>
                            <td>
                                @(i + 1)
                            </td>
                            <td>
                                @(Model.InsuranceOrderCheckLog.ToList()[i].CheckResult)
                            </td>
                            <td>
                                @(Model.InsuranceOrderCheckLog.ToList()[i].CheckRemark)
                            </td>
                            <td>
                                @(Model.InsuranceOrderCheckLog.ToList()[i].CheckTime)
                            </td>
                            <td>
                                @(Model.InsuranceOrderCheckLog.ToList()[i].CheckUserName)
                            </td>
                        </tr>
                    }
                </table>
            </td>
        </tr>
        <tr>
            <td colspan="4">审核备注：<textarea id="CheckRemark" name="CheckRemark" class="form-control"></textarea></td>
        </tr>
    </table>
    <div class="form-actions">
        @Html.HiddenFor(m => m.OrderStatus)
        <input id="btnAuditAndPass" class="btn btn-primary Edit-R" type="submit" value="审核通过">
        <input id="btnAuditAndNotPass" class="btn btn-primary Edit-R" type="submit" value="审核不通过">
        <input id="btnCancel" class="btn" type="button" value="返回" onclick="history.go(-1)">
    </div>
}
@section scripts
{
    @Scripts.Render("~/Bundles/ImagePreview")
    <script type="text/javascript">
        $(function () {
            $("img.preview").preview();
            $("#btnAuditAndPass").click(function () {
                $("#OrderStatus").val("@((byte)InsuranceOrderStatus.ApprovedAndPassed)");
            });
            $("#btnAuditAndNotPass").click(function () {
                $("#OrderStatus").val("@((byte)InsuranceOrderStatus.ApprovedButNotPassed)");
            });
        });
    </script>
}
